<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="pinpin社保" />
	<meta name="description" content="pinpin社保" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>社保运营后台-企业管理</title>
	
	<link rel="stylesheet" type="text/css" href="/as/css/style.css">
	<!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
	<link rel="stylesheet" href="/as/jquery-upload-file/css/jquery.fileupload.css">
	<link rel="stylesheet" href="/as/jquery-upload-file/css/jquery.fileupload-ui.css">
	<style type="text/css">
		.bar {
		    height: 18px;
		    background: green;
		}
	</style>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
</head>
<body>
	<div id="wrapper">
		<%@ include file="/WEB-INF/jsp/common/menu.jsp" %>
        <div id="page-wrapper">
        	<div class="row">
                <div class="col-lg-10">
                    <!-- 路径导航 -->
                    <ol class="breadcrumb">
				      <li>社保后台</li>
				      <li class="active">企业管理</li>
				      <li>
				      	<button onclick="javascript:showEntSignBox();" class="btn btn-primary btn-sm" id="entSign_btn">登记新客户</button>
				      </li>
				      <li>
				      	<button onclick="exportExcel();" class="btn btn-primary btn-sm">导出</button>
				      </li>
				      <li class="active"><a data-toggle="collapse" href="#collapseQuery" aria-expanded="false" aria-controls="collapseQuery">查询</a></li>
				    </ol>
                </div>
            </div>
            <div class="row"  style="width: 100%">
            	<div class="col-xg-12">
            		<div class="panel panel-default">
            			<div class="panel-body">
        			    	<div class="form-inline dt-bootstrap no-footer">
        			    		<!-- 表单查询 -->
        			    		<form action="${manager_uri }" method="post" id="queryCompanyForm">
        			    		<div class="row collapse" id="collapseQuery">
        			    			<div class="col-xg-12">
                                        <input type="text" class="form-control" name="name" placeholder="请输入企业名称" value="${companyQueryForm.name }">
                                        <input type="text" class="form-control" name="phone" placeholder="请输入联系电话" value="${companyQueryForm.phone }">
        			    				<label class="checkbox-inline">
	                                        <select class="form-control" name="called">
	                                            <option value="">全部回访</option>
	                                            <option value="0" <c:if test="${companyQueryForm.called eq 0 }">selected="selected"</c:if>>未回访企业</option>
	                                            <option value="1" <c:if test="${companyQueryForm.called eq 1 }">selected="selected"</c:if>>已回访企业</option>
	                                        </select>
	                                    </label>
	                                    <label class="checkbox-inline">
	                                        <select class="form-control" name="opt_sign">
	                                            <option value="">全部企业</option>
	                                            <option value="0" <c:if test="${companyQueryForm.opt_sign eq 0 }">selected="selected"</c:if>>系统登记的企业</option>
	                                            <option value="1" <c:if test="${companyQueryForm.opt_sign eq 1 }">selected="selected"</c:if>>手动登记的企业</option>
	                                            <option value="2" <c:if test="${companyQueryForm.opt_sign eq 2 }">selected="selected"</c:if>>有合同的企业</option>
	                                        </select>
	                                    </label>
	                                    <c:if test="${not empty optUserList }">
	                                    <label class="checkbox-inline">
	                                        <select class="form-control" name="opt_user">
	                                            <option value="">全部操作员</option>
	                                            <c:forEach items="${optUserList }" var="optUser">
	                                            <option value="${optUser }" <c:if test="${companyQueryForm.opt_user eq optUser }">selected="selected"</c:if>>${optUser }</option>
	                                            </c:forEach>
	                                        </select>
	                                    </label>
	                                    </c:if>
        			    			    <input type="submit" id="queryBtn" class="btn btn-primary" value="查 询">
        			    			</div>
        			    			<!-- 
        			    			<div class="col-lg-2">
        			    			    <input type="button" onclick="javascript:showEntSignBox();" class="btn btn-primary" value="登 记 企 业" id="entSign_btn">
        			    			</div> -->
        			    		</div>
        			    		</form>
        			    		<!-- 分页 -->
   			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
   			    					<jsp:param name="formId" value="queryCompanyForm"/>
   			    				</jsp:include>
        			    	
        			    		<!-- 表格列表 -->
        			    		<div class="row">
        			    			<div class="col-lg-12">
        			    				<table class="table table-striped table-bordered table-hover">
        			    					<thead>
        			    						<tr>
                                                    <th>回访登记</th>
                                                    <th>公司</th>
                                                </tr>
        			    					</thead>
        			    					<tbody>
        			    					<c:choose>
        			    						<c:when test="${empty pageModel.recordList }">
        			    							没有找到相关记录啊
        			    						</c:when>
        			    						<c:otherwise>
        			    						 	<c:set value="" var="opt_sign_bc" /> 
													<c:forEach items="${pageModel.recordList }" var="company">
													<c:if test="${company.opt_sign == 1 }"><c:set value="style='background-color:#9CF'" var="opt_sign_bc" /></c:if>
													<c:if test="${company.opt_sign == 2 }"><c:set value="style='background-color:#CFC'" var="opt_sign_bc" /></c:if>
													<c:if test="${not empty company.phone_result }"><c:set value="background-color:#FFD" var="tr_bc" /></c:if>
		        			    					<tr role="row" style="${tr_bc }">	<c:set value="" var="tr_bc" />
		                                                    <td style="text-align:left; white-space:normal; width:38%; " ${opt_sign_bc }><c:set value="" var="opt_sign_bc" /><br>
		                                                    	<button class="${empty company.phone_result ? 'btn btn-primary' : 'btn btn-success'}"
																	onclick="showPhoneCall(${company.id })">${company.opt_user } 回访</button><br>
																<c:if test="${not empty company.phone_result}">
		                                                    		${company.phone_result }<br>
		                                                    		${company.phone_time }<br>
		                                                    	</c:if><br>
																<button class="${company.contract_num > 0 ? 'btn btn-success btn-outline' : 'btn btn-info'}" id="btn${company.id }" onclick="showPhoneCall(${company.id })">上传合同</button>
		                                                    </td>
		                                                    <td style="text-align:left">
		                                                    	<label>公司：</label><span id="com${company.id }"><c:if test="${company.name != '未填写' }">${company.name }</c:if></span><br>
		                                                    	<label>业务：</label>${company.demand }<br>
		                                                    	<c:if test="${company.employees != '未填写' }">
		                                                    		<label>员工数：</label>${company.employees }<br>
		                                                    	</c:if>
		                                                    	<c:if test="${company.employees == '未填写' }">
		                                                    		<label>详细说明：</label>${company.remark }<br>
		                                                    	</c:if>
		                                                    	<label>城市：</label>${company.city }<br>
		                                                    	<label>联系人：</label>${company.contact_name } <br>
		                                                    	<label>电话：</label>${company.contact_phone } <br>
		                                                    	<c:if test="${not empty company.wechat}"><label>微信：</label>${company.wechat }<br></c:if>
		                                                    	<c:if test="${not empty company.qq}"><label>QQ：</label>${company.qq } <br></c:if>
		                                                    	<c:if test="${not empty company.email}"><label>邮箱：</label>${company.email }<br></c:if>
		                                                    	<c:if test="${not empty company.remark}"><label>备注：</label>${company.remark }<br></c:if>
		                                                    	<label>时间：</label>${company.gen_time }
		                                                    </td>
		        			    						</tr>
		        			    					</c:forEach>
        			    						</c:otherwise>
        			    					</c:choose>
        			    					</tbody>
        			    				</table>
        			    			</div>
        			    		</div>
        			    		<!-- 分页 -->
   								<jsp:include page="/WEB-INF/jsp/common/page.jsp">
   			    					<jsp:param name="formId" value="queryCompanyForm"/>
   			    				</jsp:include>
        			    	</div>
            			</div>
            		</div>
            	</div>
            </div>
        </div>
	</div>
	
	<div id="phoneCall" style="display:none; width:100%; height:380px; overflow-x: hidden; overflow-y:auto">
		<div class="row">
        	<div class="col-lg-6">
				<form action="" name="phonecallForm" id="phonecallForm" method="post">
					<label class="checkbox-inline" style="padding-bottom:10px"><b>回访描述:</b>
						<textarea name="result" id="result" class="form-control" placeholder="请填写描述，最多252个文字" cols="50" rows="3"></textarea></label>
					<label class="checkbox-inline" style="padding-left:160px">
						<button type="button" class="btn btn-primary btn-sm" onclick="javascript:phoneCall(0);">保存，不发短信</button>
					</label>	
					
					<label class="checkbox-inline" style="padding-bottom:10px"><b>短信内容：</b>
						<textarea name="sms_content" cols="50" rows="3" class="form-control">刚才致电您的020电话是【我的社保】来电，个人社保业务请直接通过APP操作即可，有疑问可咨询在线客服！企业用户客服QQ2093165845。</textarea></label>
					<input type="hidden" id="sms" name="sms"/>
					<input type="hidden" id="id" name="id"/>
					<input type="hidden" name="pageNo" value="${pageModel.pageNo }"/>
					<label class="checkbox-inline" style="padding-left:160px">
						<button type="button" class="btn btn-primary btn-info" onclick="javascript:phoneCall(1);">保存并短信</button>
					</label>
					<label class="checkbox-inline">
						<a href="javascript:showContactBox();">完善联系方式</a>
					</label>
				</form>
				
				<div id="contactBox" style="display:none;">
					<br>
					<form action="" id="contactForm" method="post">
						<input type="hidden" id="contact_id" name="id"/>
						<label class="checkbox-inline"><b>微信:</b>
							<input type="text" name="contact_wechat" class="form-control" placeholder="请填写微信【可空】"/></label>
						<label class="checkbox-inline"><b>QQ:</b>
							<input type="text" name="contact_qq" class="form-control" placeholder="请填写QQ号码【可空】"/></label>
						<label class="checkbox-inline"><b>邮箱:</b>
							<input type="text" name="contact_mail" class="form-control" placeholder="请填写邮箱【可空】"/></label>
						<label class="checkbox-inline" style="padding-top:30px">
							<button type="button" class="btn btn-primary" onclick="javascript:updateContact();">保 存</button>
						</label>
					</form>
				</div>
			
				<table class="table table-striped table-bordered table-hover no-footer">
					<tbody id="notes_body"></tbody>
				</table>
        	</div>
        	
        	<div class="col-lg-6">
				 <div class="row fileupload-buttonbar">
				 	<div class="col-lg-4">
						 <span class="btn btn-success fileinput-button">
				             <i class="glyphicon glyphicon-plus"></i>
				             <span>选择合同附件...</span>
				             <input type="file" name="files" id="fileupload" />
				         </span>
				     </div>
				     <div id="progress" class="col-lg-8">
		 				<b><span id="upload_msg"></span></b>
		 			</div>
		         </div>
		         <div id="progress" style="background:#E6E6E6">
		             <div class="bar" style="width:0%;"></div>
		         </div>
		       <table class="table table-striped table-bordered table-hover no-footer" role="grid">
			        <tr>
			            <th>文件</th>
			            <th>删除</th>
			            <th>更新时间</th>
			        </tr>
		        	<tbody id="contract_tbody"></tbody>
		        </table>
        	</div>
        </div>
	</div>
	
	
	<div id="entSignBox" style="display:none;width:100%;">
            <div class="row">
            	<div class="col-lg-12">
					<form action="" id="entForm" method="post">
            		<div class="col-lg-2">城市：</div>
			    	   	<div class="select-city-w fl col-lg-10">
			   	   	    	<i class="select-arrow"></i>	
						    <input type="text" id="city" name="city" placeholder="请选择省市名称" readonly="readonly" class="form-control">
			   	   	        <div class="select-city hide">
			   	   	        	<div>
			   	   	        		<div id="spTab" class="select-tab">
										<a href="javascript:;" class="current" name="province">省份</a>
										<a href="javascript:;" name="city">城市</a>
									</div>
									<div id="spContent">
										<div class="select-con show">
											<dl>
												<dt>A-G</dt>
												<dd>
													<a href="javascript:;" id="340000" title="安徽" name="安徽省">安徽</a>
													<a href="javascript:;" id="820000" title="澳门" name="澳门特别行政区">澳门</a>
													<a href="javascript:;" id="110000" title="北京" name="北京">北京</a>
													<a href="javascript:;" id="500000" title="重庆" name="重庆省">重庆</a>
													<a href="javascript:;" id="350000" title="福建" name="福建省">福建</a>
													<a href="javascript:;" id="620000" title="甘肃" name="甘肃省">甘肃</a>
													<a href="javascript:;" id="440000" title="广东" name="广东省">广东</a>
													<a href="javascript:;" id="450000" title="广西" name="广西壮族自治区">广西</a>
													<a href="javascript:;" id="520000" title="贵州" name="贵州省">贵州</a>
													<a href="javascript:;" id="900000" title="钓鱼岛" name="钓鱼岛">钓鱼岛</a>
												</dd>
											</dl>
											<dl>
												<dt>H-K</dt>
												<dd>
													<a href="javascript:;" id="460000" title="海南" name="海南省">海南</a>
													<a href="javascript:;" id="130000" title="河北" name="河北省">河北</a>
													<a href="javascript:;" id="410000" title="河南" name="河南省">河南</a>
													<a href="javascript:;" id="230000" title="黑龙江" name="黑龙江省">黑龙江</a>
													<a href="javascript:;" id="420000" title="湖北" name="湖北省">湖北</a>
													<a href="javascript:;" id="430000" title="湖南" name="湖南省">湖南</a>
													<a href="javascript:;" id="320000" title="江苏" name="江苏省">江苏</a>
													<a href="javascript:;" id="360000" title="江西" name="江西省">江西</a>
													<a href="javascript:;" id="220000" title="吉林" name="吉林省">吉林</a>
												</dd>
											</dl>
											<dl>
												<dt>L-S</dt>
												<dd>
													<a href="javascript:;" id="210000" title="辽宁" name="辽宁省">辽宁</a>
													<a href="javascript:;" id="150000" title="内蒙古" name="内蒙古自治区">内蒙古</a>
													<a href="javascript:;" id="640000" title="宁夏" name="宁夏回族自治区">宁夏</a>
													<a href="javascript:;" id="630000" title="青海" name="青海省">青海</a>
													<a href="javascript:;" id="370000" title="山东" name="山东省">山东</a>
													<a href="javascript:;" id="310000" title="上海" name="上海">上海</a>
													<a href="javascript:;" id="140000" title="山西" name="山西省">山西</a>
													<a href="javascript:;" id="610000" title="陕西" name="陕西省">陕西</a>
													<a href="javascript:;" id="510000" title="四川" name="四川省">四川</a>
												</dd>
											</dl>
											<dl>
												<dt>T-Z</dt>
												<dd>
													<a href="javascript:;" id="120000" title="天津" name="天津">天津</a>
													<a href="javascript:;" id="650000" title="新疆" name="新疆维吾尔自治区">新疆</a>
													<a href="javascript:;" id="540000" title="西藏" name="西藏自治区">西藏</a>
													<a href="javascript:;" id="810000" title="香港" name="香港特别行政区">香港</a>
													<a href="javascript:;" id="710000" title="台湾" name="台湾">台湾</a>
													<a href="javascript:;" id="530000" title="云南" name="云南省">云南</a>
													<a href="javascript:;" id="330000" title="浙江" name="浙江省">浙江</a>
												</dd>
											</dl>
										</div>
										<div class="select-con"></div>
									</div>
			   	   	        	</div>
			   	   	        </div>
			   	   	    </div>
            			<div class="col-lg-2" style="padding-top:10px;">公司名称：</div>
            			<div class="col-lg-4" style="padding-top:10px;">
						 	<input type="text" id="enName" name="enName" placeholder="请输入贵公司名称" class="form-control"/>
						</div>
            			<div class="col-lg-2" style="padding-top:10px;">公司人数：</div>
            			<div class="col-lg-4" style="padding-top:10px;">
				    	   	<input type="text" id="employees" name="employees" placeholder="请输入公司人数" class="form-control"/>
				    	</div>
            			<div class="col-lg-2" style="padding-top:10px;">业务需求：</div>
            			<div class="col-lg-10" style="padding-top:10px;">
				    	    <label class="checkbox-inline" style="padding-right:10px">
								<input type="checkbox" name="demand" value="劳务派遣/人事外包">劳务派遣/人事外包</label>
							<label class="checkbox-inline" >
								<input type="checkbox" name="demand" value="社保、公积金">社保、公积金</label>
				    	    <label class="checkbox-inline" style="padding-right:10px">
								<input type="checkbox" name="demand" value="商业保险">商业保险</label>
				    	    <label class="checkbox-inline" style="padding-right:10px">
								<input type="checkbox" name="demand" value="薪酬代发">薪酬代发</label>
				    	    <label class="checkbox-inline" style="padding-right:10px">
								<input type="checkbox" name="demand" value="个税代缴">个税代缴</label>
				    	    <label class="checkbox-inline" style="padding-right:10px">
								<input type="checkbox" name="demand" value="代理记账">代理记账</label>
				    	    <label class="checkbox-inline" style="padding-right:10px">
								<input type="checkbox" name="demand" value="工商注册">工商注册</label>
						</div>
			    	   <div class="col-lg-2" style="padding-top:10px;">备注:</div>
            			<div class="col-lg-10" style="padding-top:10px;">
			    	   		<textarea id="remark" name="remark" placeholder="添加备注, 最多255个文字" class="form-control"></textarea>
			    	   	</div>
			    	   	
			    	   	<c:if test="${not empty optUserList }">
				    	   	<div class="col-lg-2" style="padding-top:10px;">操作人:</div>
	            			<div class="col-lg-10" style="padding-top:10px;">
	                             <select class="form-control" name="opt_user">
	                                 <c:forEach items="${optUserList }" var="optUser">
	                                 <option value="${optUser }">${optUser }</option>
	                                 </c:forEach>
	                             </select>
				    	   	</div>
			    	   	</c:if>
            			<div class="col-lg-12" style="padding-top:10px;"><hr/></div>
            			<div class="col-lg-2" style="padding-top:10px;">联系人：</div>
            			<div class="col-lg-4" style="padding-top:10px;">
							<input type="text" id="contact_name" name="contact_name" placeholder="请输入联系人姓名" class="form-control"/>
				    	</div>
				    	<div class="col-lg-2" style="padding-top:10px;">电话：</div>
            			<div class="col-lg-4" style="padding-top:10px;">
							<input type="text" id="contact_phone" name="contact_phone" placeholder="请输入联系人的手机 / 座机" class="form-control"/>
				    	</div>
				    	<div class="col-lg-2" style="padding-top:10px;">微信：</div>
            			<div class="col-lg-4" style="padding-top:10px;">
							<input type="text" id="contact_wechat" name="contact_wechat" placeholder="微信【可空】" class="form-control"/>
				    	</div>
				    	<div class="col-lg-2" style="padding-top:10px;">QQ：</div>
            			<div class="col-lg-4" style="padding-top:10px;">
							<input type="text" id="contact_qq" name="contact_qq" placeholder="QQ号码【可空】" class="form-control"/>
				    	</div>
				    	<div class="col-lg-2" style="padding-top:10px;">邮箱：</div>
            			<div class="col-lg-4" style="padding-top:10px;">
							<input type="text" id="contact_mail" name="contact_mail" placeholder="邮箱【可空】" class="form-control"/>
				    	</div>
			    	   	<div class="col-lg-2" style="padding-top:10px;">
				    		<input type="button" value="保 存 登 记" onclick="javascript:entSign();" class="btn btn-primary" />
				    	</div>
            			<div class="col-lg-4" style="padding-top:10px;"></div>
				    </form>
	    	</div>
	    </div>
	</div>
</body>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="/as/jquery-upload-file/vendor/jquery.ui.widget.js"></script>
<!-- The basic File Upload plugin -->
<script src="/as/jquery-upload-file/jquery.fileupload.js"></script>
<!-- The File Upload user interface plugin -->
<script src="/as/js/company/company.js"></script>
<script type="text/javascript" src="/as/js/jquery.location.js"></script>
<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE 8 and IE 9 -->
<!--[if (gte IE 8)&(lt IE 10)]>
<script src="/as/jquery-upload-file/cors/jquery.xdr-transport.js"></script>
<![endif]-->
<script type="text/javascript">
var phonecall_uri = "${phonecall_uri }";
var load_notes_uri = "${load_notes_uri }";
var new_ent_uri = "${new_ent_uri }";
var edit_contact_uri = "${edit_contact_uri }";
var list_contract_uri = "${list_contract_uri }";
var upload_contract_uri = "${upload_contract_uri }";
var download_contract_uri = "${download_contract_uri }";
var del_contract_uri = "${del_contract_uri }";

function exportExcel() {
	var form = $("#queryCompanyForm");
	form.attr("action", "${manager_export_uri}");
   form.submit();
   form.attr("action", "${manager_uri}");
}

</script>
</html>